package com.sci.web.dao;

import com.jfinal.plugin.activerecord.Page;
import com.sci.web.model.genmodel.Blog;

public class BlogDao extends Blog {
	
	
	public static final BlogDao me = new BlogDao();
	
	
	
	
	
	/**
	* @Title: insertBlog
	* @Description: TODO(这里用一句话描述这个方法的作用)
	* @param @param blog
	* @param @return    参数
	* @return int    返回类型
	* @throws
	*/
	public int insertBlog(Blog blog){
		boolean save = blog.save();
		return save==true?1:0;
	}
	
	
	
	
	/**
	* @Title: updateBlog
	* @Description: TODO(这里用一句话描述这个方法的作用)
	* @param @param blog
	* @param @return    参数
	* @return int    返回类型
	* @throws
	*/
	public int updateBlog(Blog blog){
		boolean save = blog.update();
		return save==true?1:0;
	}
	
	
	
	
	
	
	
	/**
	* @Title: geetBlogPageInate
	* @Description: TODO(这里用一句话描述这个方法的作用)
	* @param @param pageNumber
	* @param @param pageSize
	* @param @return    参数
	* @return Page<Blog>    返回类型
	* @throws
	*/
	public Page<Blog> geetBlogPageInate(int pageNumber , int pageSize){
		String selelctStr = " select *  ";
		String whereStr = " from "+Blog.tableName+ " where push_state = '1' and is_delete ='0' order by push_time desc ";
		return dao.paginate(pageNumber, pageSize, selelctStr, whereStr);
	}
	
	
	
	public Blog geetBlogById(String id){
		return dao.findById(id);
	}
	
	
	
	

}
